package com.fhz.day005.model;

import com.fhz.day005.entity.Food;
import com.fhz.day005.server.ServerApi;
import com.fhz.day005.utils.RetrofitManger;

import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * 时间:2022/5/23
 *
 * @author msfeng
 * 简述: TODO
 */
public class FoodModel {

    //网络请求数据
    public void getFood(Observer<Food> observer){
        ServerApi serverApi = RetrofitManger.getInstance().getRetrofit().create(ServerApi.class);
        serverApi.getFood().subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);

    }


}

